Resource Polymorphism
نویسنده
چکیده
We present a resource-management model for ML-style programming languages, designed to be compatible with the OCaml philosophy and runtime model. This is a proposal to extend the OCaml language with destructors, move semantics, and resource polymorphism, to improve its safety, efficiency, interoperability, and expressiveness. It builds on the ownership-and-borrowing models of systems programming languages (Cyclone, C++11, Rust) and on linear types in functional programming (Linear Lisp, Clean, Alms). It continues a synthesis of resources from systems programming and resources in linear logic initiated by Baker. It is a combination of many known and some new ideas. On the novel side, it highlights the good mathematical structure of Stroustrup’s “Resource acquisition is initialisation” (RAII) idiom for resource management based on destructors, a notion sometimes confused with finalizers, and builds on it a notion of resource polymorphism, inspired by polarisation in proof theory, that mixes C++’s RAII and a tracing garbage collector (GC). In particular, it proposes to identify the types of GCed values with types with trivial destructor: from this definition it deduces a model in which GC is the default allocation mode, and where GCed values can be used without restriction both in owning and borrowing contexts. The proposal targets a new spot in the design space, with an automatic and predictable resource-management model, at the same time based on lightweight and expressive language abstractions. It is backwards-compatible: current code is expected to run with the same performance, the new abstractions fully combine with the current ones, and it supports a resource-polymorphic extension of libraries. It does so with only a few additions to the runtime, and it integrates with the current GC implementation. It is also compatible with the upcoming multicore extension, and suggests that the Rust model for eliminating data-races applies. Interesting questions arise for a safe and practical type system, many of which have already been thoroughly investigated in the languages and prototypes Cyclone, Rust, and Alms.
منابع مشابه
Stabilization of population fluctuations due to cannibalism promotes resource polymorphism in fish.
Resource polymorphism is a well-known phenomenon in many taxa, assumed to be a consequence of strong competition for resources and to be facilitated by stable environments and the presence of several profitable resources on which to specialize. In fish, resource polymorphism, in the form of planktivore-benthivore pairs, is found in a number of species. We gathered literature data on life-histor...
متن کاملIncreased competition as a cost of specialization during the evolution of resource polymorphism
Identifying the factors that promote or preclude the evolution of resource polymorphism is essential for understanding the origins of diversity. Although such polymorphisms have long been viewed as an adaptive response to intraspecific competition, they are by no means ubiquitous, even in populations experiencing strong competition. In the present study, we examined a potentially important cost...
متن کاملNeurofilament light chain gene polymorphism and risk of multiple sclerosis in Iranian patients
Background: Multiple sclerosis (MS) is a chronic disease characterized by inflammation and degeneration of the central nervous system (CNS). High levels of Neurofilament light chain (NFL) and Neurofilament heavy chain (NFH) in cerebrospinal fluid (CSF) have been associated with a wide range of neurological diseases including MS. Subjects and methods: Peripheral blood samples were collected from...
متن کاملAssociation Study of miR-124-a-3 Gene rs34059726 Polymorphism with Prostate Cancer in Gonbad Kavous
Background: MiRNAs are one of the most important genetic regulators that regulate more than 50 percent of the human genome. MiR-124-a-3 is a tumor suppressor miRNA which its expression dramatically reduced in prostate cancer tumor cells. Since miRNA binding to the transcript of target genes by seed sequence, any mutations and changes in this region could be effective on its performance and iden...
متن کاملAlternative trait combinations and secondary resource partitioning in sexually selected color polymorphism
Resource partitioning within a species, trophic polymorphism is hypothesized to evolve by disruptive selection when intraspecific competition for certain resources is severe. However, in this study, we reported the secondary partitioning of oviposition resources without resource competition in the damselfly Ischnura senegalensis. In this species, females show color polymorphism that has been ev...
متن کاملA Novel Resource Polymorphism in Fish, Driven by Differential Bottom Environments: An Example from an Ancient Lake in Japan
Divergent natural selection rooted in differential resource use can generate and maintain intraspecific eco-morphological divergence (i.e., resource polymorphism), ultimately leading to population splitting and speciation. Differing bottom environments create lake habitats with different benthos communities, which may cause selection in benthivorous fishes. Here, we document the nature of eco-m...
متن کامل